#include <bits/stdc++.h>
#include "testlib.h"
using namespace std;
const int N = 1e6+5,V = 1e6;
const double eps = 1e-4;
int c[N],n;double mx;
struct node{double x,y;}a[N];
inline double dis(node x,node y){return fabs(x.x-y.x)+fabs(x.y-y.y);}
inline bool pd(double x,double y){return fabs(x-y) < eps;}
int solve(double ans)
{
    if(!pd(0,dis({0,0},a[n])))return -2;
    for(int i = 1;i <= n;i++)mx = max(mx,dis({0,0},a[i]));
    if(!pd(ans,mx))return -1;
    for(int i = 1;i <= n;i++)
    {
        double now = dis(a[i],a[i-1]);int x = now+0.5;
        if(!pd(now,x)||x < 1||x > V||!c[x])return i;
        c[x]--;
    }
    return 0;
}
int main(int Hang,char **hang)
{
    registerTestlibCmd(Hang,hang);
    n = inf.readInt(1,V);
    for(int i = 1;i <= n;i++)c[inf.readInt(1,V)]++;
    double jans = ans.readDouble(),pans = ouf.readDouble();
    ensuref(pd(jans,pans),"Wrong Answer, Expected: %.2f, Found: %.2f",jans,pans);
    if(pd(jans,-1))quitf(_ok,"Accepted");
    for(int i = 1;i <= n;i++)a[i] = {ouf.readDouble(),ouf.readDouble()};
    int x = solve(jans);
    if(x == -2)quitp(0.6,"Wrong construction, Did not go back to (0,0)");
    if(x == -1)quitp(0.6,"Wrong construction, Expected: %.2f, Found: %.2f",jans,mx);
    if(x)quitp(0.6,"Wrong construction on step %d",x);
    quitf(_ok,"Accepted");
    return 0;
}